﻿// <copyright file="VirtualRegistryEntryBinaryValue.cs" company="Sinclair Community College">
// Copyright 2010 Sinclair Community College
// </copyright>
// <originalAuthor>Patrick S. Seymour (patrick.seymour@gmail.com)</originalAuthor>

namespace SinclairCC.AppV
{
    using System;

    /// <summary>
    /// This class represents a virtual registry entry that contains a binary value.
    /// </summary>
    internal class VirtualRegistryEntryBinaryValue : VirtualRegistryEntryValue
    {
        /// <summary>
        /// Initializes a new instance of the VirtualRegistryEntryBinaryValue class.
        /// </summary>
        /// <param name="rawData">
        /// The raw data registry data contained in the CP file.
        /// </param>
        public VirtualRegistryEntryBinaryValue(byte[] rawData)
            : base(rawData)
        {
        }

        /// <summary>
        /// Creates a string representation of the registry value.
        /// </summary>
        /// <returns>
        /// Returns a string representation of the registry value.
        /// </returns>
        public override string ToString()
        {
            System.Text.StringBuilder buffer = new System.Text.StringBuilder("{");
            for (int i = 0; i < this.RawValue.Length; i++)
            {
                buffer.Append(this.RawValue[i].ToString("00"));
                if (i < (RawValue.Length - 1))
                {
                    buffer.Append(", ");
                }
            }

            buffer.Append("}");
            return buffer.ToString();
        }
    }
}
